import gugga.application.ApplicationController;

/**
 * @author branimir
 * 
 * TODO: When we move this class in the framework, we should create interface IDeepLinksSerializer. 
 * ApplicationController should have factory method for instantinating concrete DeepLinksSerializer 
 * for the application, which will be used by BrowserHistoryManager.
 * 
 * @see BrowserHistoryManager
 */
class gugga.common.DeepLinksSerializer 
{
	private static var NAVIGATION_PATH_KEY : String = "navigationPath";
	
	public static function serializeCurrentNavigationPath(aOutput : Object) : Void 	
	{
		var applicationController : ApplicationController = ApplicationController(_global["ApplicationController"]);
		var path : String = applicationController["mPendingSectionPath"];
		if(!path)
		{
			path = applicationController.TargetSectionPath;
		}
		if(!path)
		{
			path = applicationController.CurrentSectionPath;
		}
		aOutput[NAVIGATION_PATH_KEY] = path;
	}
	
	public static function deserializeNavigationPath(aInput : Object) : String
	{
		var result : String = aInput[NAVIGATION_PATH_KEY];
		return result;
	}
}